package io.bsly.modules.app.controller;

import io.bsly.common.utils.PageUtils;
import io.bsly.common.utils.R;
import io.bsly.modules.app.entity.sourceEntity.CanalsRoomEntity;
import io.bsly.modules.app.entity.sourceEntity.HotelEntity;
import io.bsly.modules.app.pojo.HotelRoomTypeVo;
import io.bsly.modules.app.pojo.HotelVo;
import io.bsly.modules.app.pojo.RoomTypeFrom;
import io.bsly.modules.app.service.sourceDb.HotelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "酒店管理")
@RestController
@RequestMapping("app/hotel")
public class HotelController {
    @Autowired
    private HotelService hotelService;

    /**
     * 列表
     */
    @ApiOperation("分页展示")
    @GetMapping("/list")
    public R list(HotelVo vo){
        PageUtils page = hotelService.queryPage(vo);
        return R.ok().put("page", page);
    }



    /**
     * 信息
     */
    @ApiOperation("根据ID查询")
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		HotelEntity hotel = hotelService.getById(id);
        return R.ok().put("hotel", hotel);
    }


    /**
     * C端用户查询房型
     * 列表
     */
    @ApiOperation("根据酒店id和含餐情况查询")
    @PostMapping("/listRoom")
    public R listRoom(@RequestBody @Valid RoomTypeFrom from){
        List<CanalsRoomEntity> list = hotelService.listRoom(from);
        return R.ok().put("list", list);
    }



}
